<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>
<c:set value="${requestScope.response.data.pageInfoUtil }" var="pageInfoUtil"/>
<c:set value="${requestScope.response.data.list }" var="list"/>
<jsp:useBean class="com.wangsh.train.job.pojo.AJobOffer" id="pojo"/>
<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<title>offer列表 - 培训机构</title>
		<%@ include file="/common/include/title.jsp"%>
		<script type="text/javascript" src="${rootPath }/common/resource/My97DatePicker/WdatePicker.js"></script>
		<script type="text/javascript">
			/*
				批量操作切换
				selId:要选择的select
				tarVal:要具体判断的值
				tarDiv:最终要显示的dom
			*/
			function batchSwitch(selId)
			{
				var selVal = $("#" + selId).val();
				/* 所有的选择信息都隐藏掉 */
				$(".selectInfo").hide();
				/* 相关的显示 */
				if('status' == selVal)
				{
					$("#update" + selVal).show();
				}
			}
		</script>
	</head>
	<body>
		<%@ include file="/common/include/header.jsp"%>
		<!-- 网页的主体部分 -->
		<div class="container">
			<div class="row">
				<div class="col-">
					<h2 class="sub-header">offer列表</h2>
					<form action="${rootPath }/head/job/offerList.htm" method="post" class="form-inline">
						<input type="hidden" name="searchType" value="${requestScope.searchType }">
						
						<label for="keyword">关键字:</label>
						<input type="text" name="keyword" value="${requestScope.keyword }" class="form-control mr-sm-2">
						<label for="fiveRisks">五险:</label>
						<select name="fiveRisks" class="form-control mr-sm-2">
							<option value="">请选择</option>
							<c:set value="1" var="currCount"/>
							<c:forEach items="${pojo.enumsMap }" var="me" varStatus="stat">
								<c:if test="${fn:startsWith(me.key,'FIVERISKS')}">
									<!-- 拆分,按照-拆分,取最后一个 -->
									<c:set value="${fn:split(me.key, '-')}" var="keys"/>
									<option value="${keys[1] }" ${keys[1] == requestScope.fiveRisks ? 'selected' : '' }>${me.value }</option>
									<c:set value="${currCount + 1 }" var="currCount"/>
								</c:if>
							</c:forEach>
						</select>
						<label for="accFund">公积金:</label>
						<select name="accFund" class="form-control mr-sm-2">
							<option value="">请选择</option>
							<c:set value="1" var="currCount"/>
							<c:forEach items="${pojo.enumsMap }" var="me" varStatus="stat">
								<c:if test="${fn:startsWith(me.key,'ACCFUND')}">
									<!-- 拆分,按照-拆分,取最后一个 -->
									<c:set value="${fn:split(me.key, '-')}" var="keys"/>
									<option value="${keys[1] }" ${keys[1] == requestScope.accFund ? 'selected' : '' }>${me.value }</option>
									<c:set value="${currCount + 1 }" var="currCount"/>
									&nbsp;&nbsp;
								</c:if>
							</c:forEach>
						</select>
						<label for="pubTime">发布时间:</label>
						<input type="text" name="st" value="${requestScope.st }" readonly="true" class="form-control mr-sm-2" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate"/>
						-->
						<input type="text" name="ed" value="${requestScope.ed }" readonly="true" class="form-control mr-sm-2" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate"/>
						<input type="submit" class="btn btn-primary" value="搜索">
						<c:if test="${param.companyId != null && param.companyId != ''}">
							<a href="${rootPath }/head/job/offerInsert.htm?companyId=${param.companyId}&comPosiId=${param.comPosiId}" class="btn btn-primary ml-2" target="_blank">添加</a>
						</c:if>
					</form>
				</div>
				<div class="col-">
					<div class="table-responsive mt-2">
						<!-- 要做批量操作 -->
						<form action="${rootPath }/head/job/offerBatch.htm" method="post" class="form-inline" id="batchForm">
							<label for="status">操作类型:</label>
							<select name="operType" id="operType" class="form-control mr-sm-2" onchange="batchSwitch('operType')">
								<option value="">请选择</option>
								<option value="status">修改状态</option>
							</select>
							<div class="form-row selectInfo" id="updatestatus" style="display: none;">
								<label for="status">状态:</label>
								<select name="status" class="form-control mr-sm-2">
									<c:forEach items="${pojo.enumsMap }" var="me" varStatus="stat">
										<c:if test="${fn:startsWith(me.key,'STATUS')}">
											<!-- 拆分,按照-拆分,取最后一个 -->
											<c:set value="${fn:split(me.key, '-')}" var="keys"/>
											<option value="${keys[1] }" ${requestScope.status == keys[1] ? 'selected' : '' }>${me.value }</option>
										</c:if>
									</c:forEach>
								</select>
							</div>
							<input type="button" class="btn btn-primary" value="提交" onclick="return requestConfirm('batchForm','ids')">
							<table class="table table-striped table-hover">
								<thead>
									<tr>
										<th>
											<div class="form-group form-check">
												<input type="checkbox" name="selectAll" id="selectAll" class="form-check-input" onclick="checkAll('selectAll','ids')">
											</div>
										</th>
										<th>序号</th>
										<th title="创建人">创人</th>
										<th>公司</th>
										<th>职位</th>
										<th>名称</th>
										<th>工资</th>
										<th>五险</th>
										<th>公积金</th>
										<th title="面试次数">面次</th>
										<th>状态</th>
										<th>发布时间</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<c:forEach items="${list }" var="listTemp" varStatus="stat">
										<tr>
											<td>
												<div class="form-group form-check">
													<input type="checkbox" name="ids" value="${listTemp.id}" class="form-check-input">
												</div>
											</td>
											<td>${stat.count }</td>
											<td title="${listTemp.create.nickName }">
												${fn:substring(listTemp.create.nickName,0,subStrLen) }
											</td>
											<td title="${listTemp.company.name }">
												<a href="${rootPath}/head/job/jobCompanyUpdate.htm?id=${listTemp.companyId}" target="_blank">
													${fn:substring(listTemp.company.name,0,subStrLen) }
												</a>
											</td>
											<td title="${listTemp.comPosition.name }">
												<a href="${rootPath}/head/job/comPositionUpdate.htm?id=${listTemp.comPosiId}" target="_blank">
													${fn:substring(listTemp.comPosition.name,0,subStrLen) }
												</a>
											</td>
											<td title="${listTemp.name }">
												<a href="${rootPath}/head/job/offerUpdate.htm?id=${listTemp.id}" target="_blank">
													${fn:substring(listTemp.name,0,subStrLen) }
												</a>
											</td>
											<td title="${listTemp.wages }">
												${listTemp.wages}
											</td>
											<td>
												${listTemp.fiveRisksStr }
											</td>
											<td>
												${listTemp.accFundStr }
											</td>
											<td>${listTemp.interCount }</td>
											<td>${listTemp.statusStr }</td>
											<td>${listTemp.pubTime }</td>
											<td>
												<c:if test="${listTemp.statusEnum == 'STATUS_DRAFT' || listTemp.statusEnum == 'STATUS_AUDITNO'}">
													<a href="${rootPath}/head/job/offerUpdate.htm?operType=update&id=${listTemp.id}" target="_blank">
														修改
													</a>
													<br/>
													<a href="${rootPath}/head/job/offerUpdate.htm?operType=file&id=${listTemp.id}&fileRelaType=4" target="_blank">
														上传附件
													</a>
													<br/>
													<a href="${rootPath}/head/system/sysFileList.htm?relaId=${listTemp.id}&fileRelaType=4&operType=update" target="_blank">
														查看附件
													</a>
												</c:if>
											</td>
										</tr>
									</c:forEach>							
								</tbody>
							</table>
						</form>
					</div>
				</div>
				<div class="col-">
					<form id="pageForm" action="${rootPath }/head/job/offerList.htm"
						method="post" class="form-inline">
						<!-- 设置一些参数 -->
						<input type="hidden" name="keyword" value="${requestScope.keyword }">
						<input type="hidden" name="st" value="${requestScope.st }">
						<input type="hidden" name="ed" value="${requestScope.ed }">

						<input type="hidden" name="searchType" value="${requestScope.searchType }">
						<input type="hidden" name="companyId" value="${requestScope.companyId }">
						<input type="hidden" name="fiveRisks" value="${requestScope.fiveRisks }">
						<input type="hidden" name="accFund" value="${requestScope.accFund }">
						
	
						<nav aria-label="Page navigation example">
							<ul class="pagination justify-content-end">
								<li class="page-item">
									<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '1', 'pageSize','${pageInfoUtil.pageSize}')">
										<span>首页</span>
									</a>
								</li>
								<li class="page-item">
									<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '${pageInfoUtil.prePage}', 'pageSize','${pageInfoUtil.pageSize}')">
										<span>上一页</span>
									</a>
								</li>
								<li class="page-item">
									<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '${pageInfoUtil.nextPage}', 'pageSize','${pageInfoUtil.pageSize}')">
										<span>下一页</span>
									</a>
								</li>
								<li class="page-item">
									<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '${pageInfoUtil.totalPage}', 'pageSize','${pageInfoUtil.pageSize}')">
										<span>尾页</span>
									</a>
								</li>
								<li class="page-item">共${pageInfoUtil.totalRecord }条,共${pageInfoUtil.totalPage}页</li>
								<li class="page-item">
									第<input type="text" id="currentPage" name="currentPage" class="form-control" value="${pageInfoUtil.currentPage }"  size="5" maxlength="5"/>页
								</li>
								<li class="page-item">
									<input type="text" id="pageSize" name="pageSize" class="form-control" value="${pageInfoUtil.pageSize }" size="5" maxlength="5"/>
								</li>
								<li class="page-item"><input type="submit" value="GO" class="form-control btn btn-primary"/></li>
							</ul>
						</nav>
					</form>
				</div>
			</div>
		</div>
		<%@ include file="/common/include/footer.jsp"%>
	</body>
</html>